//
//  YCProductCategory.m
//  DemoCoreData
//
//  Created by 唐可雄 on 16/3/16.
//  Copyright © 2016年 tangkexiong. All rights reserved.
//

#import "YCProductCategory.h"

#import "YCProduct.h"

@implementation YCProductCategory

- (void)addProduct:(YCProduct *)product {
    NSMutableArray *array = [NSMutableArray arrayWithArray:self.mProducts];
    [array addObject:product];
    
    self.mProducts = array;
}

- (void)addProducts:(NSArray<YCProduct *> *)products {
    NSMutableArray *array = [NSMutableArray arrayWithArray:self.mProducts];
    for (YCProduct *product in products) {
        [array addObject:product];
    }
    
    self.mProducts = array;
}

- (void)removeProduct:(YCProduct *)product {
    NSMutableArray *array = [NSMutableArray arrayWithArray:self.mProducts];
    [array removeObject:product];
    
    self.mProducts = array;
}

- (void)removeProducts:(NSArray<YCProduct *> *)products {
    NSMutableArray *array = [NSMutableArray arrayWithArray:self.mProducts];
    for (YCProduct *product in products) {
        [array removeObject:product];
    }
    
    self.mProducts = array;
}

@end
